

/**
 * Memory Management Unit Driver Functions
 * ==============================================
 *
 * Mapping 1st transfer table with 1 MB section
 * Mapping 2nd transfer table with 4 KB section
 *
 * DY Young @Xitieying Beijing, 2024 CN
 */

void mmu_map_page(unsigned *ptable, unsigned va, unsigned pa, int nr, unsigned attr)
{
}

void map_1m_section(unsigned *ptable, unsigned va, unsigned pa, int nr, unsigned attr)
{
    unsigned va_indx = va >> 20; // 1M align
    unsigned entry = (pa & 0xfff00000) | (attr & 0xfffff);
    unsigned *addr = ptable + va_indx;
    for (int i = 0; i < nr; i++)
    {
        *addr = entry;
        addr++;
        entry += 0x100000;
    }
}